/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.etop.odbs.beans;

import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 *
 * @author cjh
 */
@Entity
@Table(name = "document")
public class Document {

    private int id;
    private String classification;  //上传者对于文档的分类
    private String filename;        //文档名
    private String format;          //文档格式
    private int isPublic;           //文档是否公开
    private String description;     //对文档的描述
    private String path;            //文档所在的路径
    private int point;              //文档下载的积分
    private Date uploadTime;        //文档的上传时间
    private User user;              //文档的上传者

    @Id
    @GeneratedValue
    public int getId() {
        return id;
    }

    public String getClassification() {
        return classification;
    }

    public String getFilename() {
        return filename;
    }

    public String getFormat() {
        return format;
    }

    public int getIsPublic() {
        return isPublic;
    }

    public String getDescription() {
        return description;
    }

    public String getPath() {
        return path;
    }

    public int getPoint() {
        return point;
    }

    public Date getUploadTime() {
        return uploadTime;
    }

    @ManyToOne
    @JoinColumn(name = "uid")
    public User getUser() {
        return user;
    }

    public void setId(int id) {
        this.id = id;
    }

    public void setClassification(String classification) {
        this.classification = classification;
    }

    public void setFilename(String filename) {
        this.filename = filename;
    }

    public void setFormat(String format) {
        this.format = format;
    }

    public void setIsPublic(int isPublic) {
        this.isPublic = isPublic;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public void setPoint(int point) {
        this.point = point;
    }

    public void setUploadTime(Date uploadTime) {
        this.uploadTime = uploadTime;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @Override
    public String toString() {
        return "Document{" + "id=" + id + ", filename=" + filename + ", user=" + user.getNickname() + ", format=" + format + ", isPublic=" + isPublic + '}';
    }

}
